﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class UserControl_ControlChangePassMarketers : System.Web.UI.UserControl
{
    ClassExecute.ClassExecute dt;
    string str = webapp4U.Configuration.CurrentConnectionString;
    string error = "";
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            txtUserName.Text = Session["user"].ToString();
        }
    }
    protected void ImgSave_Click(object sender, ImageClickEventArgs e)
    {
        dt = new ClassExecute.ClassExecute();
        int i = dt.ExecuteSQl_int(str, "k_changePassMarketers", CommandType.StoredProcedure, ref error,
            new SqlParameter("@UserName", Session["user"].ToString()),
            new SqlParameter("@OldPass", dt.GetMd5Sum(txtOldPass.Text)),
            new SqlParameter("@NewPass", dt.GetMd5Sum(txtNewPass.Text)),
            new SqlParameter("@PassHint",txtNewPass.Text));
        if (i == 1)
        {
            uscMsgBox1.AddMessage("Thay đổi mật khẩu thành công", uscMsgBox.enmMessageType.Success);
        }
        else
        {
            uscMsgBox1.AddMessage("Mật khẩu cũ không chính sách", uscMsgBox.enmMessageType.Success);
        }
    }
}